<?php

namespace App\Models;

use DateTimeInterface;
use Illuminate\Database\Eloquent\Model;

class ApprovalBookTitle extends Model
{
    protected $appends = ['status_text'];

    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }

    protected $fillable = [
        'status'
    ];

    /**
     * 追加状态数据
     * @return string
     */
    public function getStatusTextAttribute()
    {
        $statusArr = [
            0 => '待审批',
            1 => '已通过',
            2 => '已拒绝',
        ];

        return $statusArr[$this->status];
    }
}
